"""
Get cores
"""

from typing import Union
import multiprocessing

def get_cores(core_usage: Union[float, int])->Union[float, int]:
    """_summary_

    Args:
        core_usage (Union[float, int]): _description_

    Returns:
        Union[float, int]: _description_
    """
    total_cores = multiprocessing.cpu_count()

    if core_usage > 1:
        if core_usage < total_cores:
            return core_usage
        else:
            return int(total_cores*0.8)
    else:
        return int(total_cores*core_usage)
